package examination;

import java.util.Scanner;

/**
 * @author Xiao
 * @date 2021/7/10
 */
public class Test01_GXJ {
    public static void main(String[] args) {
        int count1 = 0;
        int count2 = 0;
        int count3 = 0;
        int count4 = 0;
        Scanner sc = new Scanner(System.in);
        char[] chars;
        loop:
        while (true) {
            System.out.println("请输入");
            String teel = sc.nextLine();
            chars = teel.toCharArray();
            for (int i = 0; i < chars.length; i++) {
                char cha = chars[i];
                if (cha >= 'A' && cha <= 'Z') {
                    break loop;
                }
            }
            System.out.println("你没有输入大写字母");
        }
        for (int i = 0; i < chars.length; i++) {
            char cha = chars[i];
            if (cha >= 'A' && cha <= 'Z') {
                count1++;
            } else if (cha >= 'a' && cha <= 'z') {
                count2++;
            } else if (cha >= '1' && cha <= '9') {
                count3++;
            } else {
                count4++;
            }
        }
        System.out.println('A' + "至" + 'Z' + "的次数为" + count1);
        System.out.println('a' + "至" + 'z' + "的次数为" + count2);
        System.out.println('1' + "至" + '9' + "的次数为" + count3);
        System.out.println("其他字符的次数为" + count4);
    }
}
